<?php
require("../../class/connect.php");
include("../../class/config.php");
include("../../class/db_sql.php");
include("../../class/q_functions.php");
include("../../class/user.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
if($public_r['memberlistlevel'])
{
	$user=islogin();
	if($level_r[$user[groupid]]['level']<$level_r[$public_r[memberlistlevel]]['level'])
	{
		printerror("NotLevelMemberList","",1);
	}
}
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$line=25;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$start+$page*$line;//总偏移量
$search='';
$add='';
$where=' where ';
//搜索
$groupid=(int)$_GET['groupid'];
if($groupid)
{
	$add.=" where ".$user_group."='$groupid'";
	$where=' and ';
	$search.="&groupid=".$groupid;
}
$sear=$_GET['sear'];
if($sear)
{
	$keyboard=RepPostVar2($_GET['keyboard']);
	if($keyboard)
	{
		$add.=$where.$user_username." like '%$keyboard%'";
	}
	$search.="&sear=1&keyboard=$keyboard";
}
$totalnum=(int)$_GET['totalnum'];
if(empty($totalnum))
{
	$totalquery="select count(*) as total from {$user_tablename}".$add;
	$num=$empire->gettotal($totalquery);//取得总条数
}
else
{
	$num=$totalnum;
}
$search.='&totalnum='.$num;
$query="select $user_userid,$user_username,$user_email,$user_registertime from {$user_tablename}".$add;
$query=$query." order by ".$user_userid." desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
$url="<a href='../../../'>首页</a>&nbsp;>&nbsp;会员列表";
@include("../../data/template/cp_1.php");
?> 
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <form name="memberform" method="get" action="index.php">
    <input type="hidden" name="sear" value="1">
    <input type="hidden" name="groupid" value="<?=$groupid?>">
    <tr class="header"> 
      <td width="10%"><div align="center">ID</div></td>
      <td width="38%" height="25"><div align="center">用户名</div></td>
      <td width="30%" height="25"><div align="center">注册时间</div></td>
      <td width="22%" height="25"><div align="center"></div></td>
    </tr>
    <?php
	while($r=$empire->fetch($sql))
	{
		$registertime=$user_register?date("Y-m-d H:i:s",$r[$user_registertime]):$r[$user_registertime];
		//$addr=$empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='".$r[$user_userid]."' limit 1");
	?>
    <tr bgcolor="#FFFFFF"> 
      <td><div align="center"> 
          <?=$r[$user_userid]?>
        </div></td>
      <td height="25"> <a href='<?=$public_r[newsurl]?>e/space?userid=<?=$r[$user_userid]?>' target='_blank'> 
        <?=$r[$user_username]?>
        </a> </td>
      <td height="25"><div align="center"> 
          <?=$registertime?>
        </div></td>
      <td height="25"><div align="center"> [<a href="<?=$public_r[newsurl]?>e/member/ShowInfo?userid=<?=$r[$user_userid]?>" target="_blank">会员资料</a>] 
          [<a href="<?=$public_r[newsurl]?>e/space?userid=<?=$r[$user_userid]?>" target="_blank">会员空间</a>]</div></td>
    </tr>
    <?
  	}
  	?>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="3"> 
        <?=$returnpage?>
      </td>
      <td height="25"> <div align="center"> 
          <input name="keyboard" type="text" id="keyboard" size="10">
          <input type="submit" name="Submit" value="搜索">
        </div></td>
    </tr>
  </form>
</table>
<?
@include("../../data/template/cp_2.php");
db_close();
$empire=null;
?>
